<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="__PUBLIC__/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="__PUBLIC__/css/my.css">
    <title>用户登录</title>
</head>
<body class="adminlogin">

<div class="conatiner mt50">
    <div class="clearfix mt50"></div>
    <h1 class="text-center mt50">重置密码</h1>
    <hr>

    <form onsubmit="return false;" class="form-horizontal col-md-4 col-md-offset-4">


        <div class="form-group">
            <div class="col-md-12">
                <input type="password" name="passwd" class="form-control input-lg passwd" placeholder="请输入密码">
            </div>
        </div>


        <div class="form-group">
            <div class="col-md-12">
                <button class="btn btn-primary btn-lg btn-block chang" >修改</button>
            </div>
        </div>

    </form>
</div><!-- END container -->


<!-- 此处引入jQuery -->
<script src="__PUBLIC__/js/jquery.min.js"></script>
<!-- bootstrap.min.js必须放在JQ后面 -->
<script src="__PUBLIC__/js/bootstrap.min.js"></script>
<script>
    $('.chang').click(function () {
        if($('.passwd').val() == '')
        {
            alert('密码不能为空！');
            return false;
        }
        $.ajax({
            type:'post',
            url:"{:U('User/changPasswd')}",
            data:{'passwd':$('.passwd').val(),'email':'<?=$email?>','code':'<?=$code?>'},
            success:function(data){
                alert(data.message)
                //跳转到登录页
                window.location.href = '{:U("User/login")}';
            }
        })
    });
</script>
</body>
</html>